// components/song-item-v2/index.js
import { playerStore } from "../../store/index"
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    tracks: {
      type: Array,
      value: []
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleItemClick(event) {
      const index = event.currentTarget.dataset.item[1]
      const id = event.currentTarget.dataset.item[0].id
      const playListSongs = event.currentTarget.dataset.item[2]
      const iscloud = playListSongs[index].iscloud ? true : false
      playerStore.setState("iscloud", iscloud)
      wx.navigateTo({
        url: '../../pages/music-player/index?id=' + id,
      })
      playerStore.dispatch("playMusicIdInfoAction", { id })
      playerStore.setState("playListIndex", index)
      playerStore.setState("playListSongs", playListSongs)
    }
  }
})
